<template>
	<view>
		<view class="add">我的地址</view>
		<view>
		</view>
		<view v-for="(item,index) in selectAddress">
			{{item.addressId}} {{item.provinceId}} {{item.cityId}} {{item.areaId}} {{item.address}}
			{{item.receiveName}} {{receivePhone}}  {{item.addressStatus}}
			<button @click="deleteaddress(item.addressId)">删除</button>
			<button @click="putAddress(index)">编辑地址</button>
		</view>
		<view @click="addadress" class="add">
			+ 新增地址
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				selectAddress: [{
				}],
				address: {
					limit: 1,
					size: 5
				}
			}
		},
		onLoad: function() {
				this.$req.getAddressSelect(this.address).then(res => {
					console.log(res)
					this.selectAddress = res.data.list
					console.log(this.selectAddress)
					console.log(res.data.list)
				})
		},
		methods: {
			addadress() {
				uni.navigateTo({
					url: '../addadress/addadress'
				})
			},
			deleteaddress(address1) {
				this.$req.AddressDelete(address1).then(res =>{
					console.log(this.address1)
				})
			},
			putAddress(index) {
				uni.setStorageSync("myaddress",this.selectAddress[index]),
				uni.navigateTo({
					url: '../putAddress/putAddress'
				})
			}
		}
	}
</script>

<style>
	.add {
		font-size: 40rpx;
		border: 1rpx solid #DD514C;
		border-radius: 20rpx;
		text-align: center;
		background-color: #FDE6D2;
	}
</style>
